
//
//  YKAnimationDismissedProxy.m
//  AnchorPoint
//
//  Created by 吴高烽 on 2016/11/20.
//  Copyright © 2016年 吴高烽. All rights reserved.
//

#import "YKAnimationDismissedProxy.h"

@implementation YKAnimationDismissedProxy
//执行转场时间
- (NSTimeInterval)transitionDuration:(nullable id <UIViewControllerContextTransitioning>)transitionContext{
    return 0.5f;
}
//执行转场动画
- (void)animateTransition:(id <UIViewControllerContextTransitioning>)transitionContext{
//    1. 获取转场动画的fromView
    UIView *fromView = [transitionContext viewForKey:UITransitionContextFromViewKey];
//    2. 判断view的旋转角度
    [UIView animateWithDuration:[self transitionDuration:transitionContext] animations:^{
        if (fromView.transform.b > 0) {
            fromView.transform = CGAffineTransformMakeRotation(M_PI_2);
        }else{
            fromView.transform = CGAffineTransformMakeRotation(-M_PI_2);
        }
    } completion:^(BOOL finished) {
        [transitionContext completeTransition:YES];
    }];
 
}
@end
